<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        
        //基类提取需要在子类中需要重写的
        //子类对方法进行重写
        var people = function(sex,age){
            this.sex = sex
            this.age = age
        }
        people.prototype.hobby = function(){
            //私有属性
            console.log('人类的爱好')
        }
        people.prototype.thinking = function(){
            console.log( '人类对价值观')
        }
        var women = function(sex,age,weight){
            this.weight = weigh
            people.call(this,sex,age)
        }
        women.prototype.hobby = function (){
            console.log('女生爱逛街和化妆')
        }
        women.prototype.thinking = function(){
            console.log('比较感性')
        }
        women.prototype.cooking = function(){
            console.log('女生会烘焙')
        }
        var man = function(sex,age,height){
            this.height = height
            people.call(this,sex,age)
        }
        man.prototype.hobby = function(){
            console.log('男生爱运动和游戏')
        }
        man.prototype.thinking = function (){
            console.log('比较理性')
        }
        //man特有方法，可以说是原生对象的方法
        man.prototype.playball = function(){
            console.log('男生会打篮球')
        }
        //原型对象，可以共享的方法
        var man1  = new man('man','23','180')
        var female1 = new women('women','18','45')
        man1.hobby()
        man1.cook()
        female1.hobby()
        female1.playball()
    </script>
</body>
</html>